/**
 * Created by liuqingling on 16/4/25.
 */
//"url-loader": "^0.5.7",
//    "less-loader": "^2.2.2",
//    "file-loader": "^0.8.5",
//    "css-loader": "^0.23.1",
//    "webpack-dev-middleware": "^1.2.0",
//    "webpack-hot-middleware": "^2.2.0"
var path = require('path')
var webpack = require('webpack')

module.exports = {
    devtool: 'cheap-module-eval-source-map',
    entry: [
        'webpack-hot-middleware/client',
        './todomvc/index.js'
    ],
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'bundle.js',
        publicPath: '/static/'
    },
    plugins: [
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin()
    ],
    module: {

        loaders: [{
            test: /\.js$/,
            loaders: [ 'babel' ],
            exclude: /node_modules/,
            include: __dirname
        }, {
            test: /\.css?$/,
            loaders: [ 'style', 'raw','css' ],
            include: __dirname
        },
            { test: /\.less$/, loader: 'style-loader!css-loader!less-loader' }, // 用!去链式调用loader
            { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'},]
    }
}

// When inside Redux repo, prefer src to compiled version.
// You can safely delete these lines in your project.
//var reduxSrc = path.join(__dirname, '..', '..', 'src')
////获取redux路径 __dirname = 当前文件所在的目录
//var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
//var fs = require('fs')
//
//if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
//  // Resolve Redux to source
//  module.exports.resolve = { alias: { 'redux': reduxSrc } }
//  // Compile Redux from source
//  module.exports.module.loaders.push({
//    test: /\.js$/,
//    loaders: [ 'babel' ],
//    include: reduxSrc
//  })
//}
